package hash.simple;


import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;

public class RelativeRanking_506 {
    public String[] findRelativeRanks(int[] score){
        TreeMap<Integer, Integer> map = new TreeMap<>((a, b) -> b - a);
        for (int i = 0; i < score.length; i++) {
            map.put(score[i], i);
        }
        int i = 0;
        String[] ming = {"Gold Medal", "Silver Medal", "Bronze Medal"};
        String[] res = new String[score.length];
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if (i < ming.length) {
                res[entry.getValue()] = ming[i++];
                continue;
            }
            res[entry.getValue()] = String.valueOf(i + 1);
            i++;
        }
        return res;
    }

    public static void main(String[] args) {
        RelativeRanking_506 rr = new RelativeRanking_506();
        rr.findRelativeRanks(new int[]{5,4,3,2,1});
    }
}
